<block name="content">
    <form class="layui-form inline-form">
        <div class="pull-left">
            <div class="layui-inline dropdown">
                <select name="doc_type" lay-search lay-filter="doc_type">
                    <option value="">选择文档类型</option>
                    <volist name="doc_type" id="vo" key="k">
                        <option value="{$k}"> {$vo}</option>
                    </volist>
                </select>
            </div>
            <div class="layui-inline dropdown">
                <input name="title" class="layui-input" type="text" id="doctitle" placeholder="文档名称">
            </div>
            <div class="layui-inline">
                <button class="layui-btn  layui-btn-normal" lay-submit lay-filter="docsearch_btn"><i
                        class="layui-icon">&#xe615;</i>搜索
                </button>
            </div>
            <div class="layui-inline">
                <button class="layui-btn layui-btn-normal  ajax-form"
                        data-url="{:url('project/docadmin/docadd?&project_id='.$project_id)}"><i
                        class="layui-icon">&#xe61f;</i> 新增
                </button>
            </div>
        </div>
    </form>
    <table class="layui-table text-center" id="list" lay-filter="list"
           list-url="{:url('project/docadmin/doclists?project_id='.$project_id)}"
           edit-url="{:url('project/docadmin/doceditform?project_id='.$project_id)}"
           assigned-url="{:url('project/docadmin/doceditcategory?project_id='.$project_id)}"
           del-url="{:url('project/docadmin/docdelete?project_id='.$project_id)}"
           delinfo-url="{:url('project/docadmin/docdelete?project_id='.$project_id)}"></table>

</block>
<block name="script">
    <script charset="utf-8" src="https://cdn.weibuyun.com/static/admin/plugins/wangeditor/wangEditor.min.js"></script>
    <script charset="utf-8" src="https://unpkg.com/qiniu-js@2.5.4/dist/qiniu.min.js"></script>
    <script type="text/html" id="barDemo">
        <a class="layui-btn  layui-btn-xs" lay-event="forms" forms-url="{:url('project/docadmin/docwork?project_id='.$project_id)}"><i
                class="fa fa-laptop"></i>查看</a>
        <a class="layui-btn  layui-btn-xs " lay-event="edit"><i class="fa fa-pencil"></i> 编辑</a>
        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delete"> <i class="fa fa-trash-o"></i> 删除</a>
    </script>
    <script type="text/javascript">
        layui.use(['element', 'table', 'form', 'tree'], function () {
            var table = layui.table
                , element = layui.element
                , form = layui.form;
            table.render({
                elem: '#list'
                , url: "{:Url('project/docadmin/doclists?project_id='.$project_id)}"
                , page: true
                ,limit:20
                , cols: [[
                     {field: 'doc_type', width: 100, title: '文档类型'}
                    , {field: 'doc_view', width: 100, title: '文档可见'}
                    , {field: 'title', title: '文档名称', edit: 'text'}
                    , {field: 'nickname', width: 90, title: '发布人'}
                    , {field: 'c_time', width: 120, title: '创建时间'}
                    , {fixed: 'right', width: 200, title: '操作', toolbar: '#barDemo'}
                ]]
            });

            form.on('submit(docsearch_btn)', function (data) {
                table.reload('list', {
                    url: "{:Url('project/docadmin/doclists?project_id='.$project_id)}"
                    , page: {
                        curr: 1
                    }
                    , where: data.field
                });
                return false;
            });
            form.on('select(doc_type)', function (data) {
                table.reload('list', {
                    url: "{:Url('project/docadmin/doclists?project_id='.$project_id)}"
                    , page: {
                        curr: 1
                    }
                    , where: {
                        status: data.value
                    }
                });
                return false;
            });

        });
    </script>
</block>
